<?php
	//处理注册数据的录入
	$username = $_POST['username'];
	$password = $_POST['password'];
	$question = $_POST['question'];
	$answer = $_POST['answer'];
	$blog_name = $_POST['blog_name'];

	$connection = mysql_connect("localhost", "root", "zxt@ljj");
	mysql_select_db("light_blogs", $connection);
	
	$sql = "insert into users values('$username', '$password', '$question', '$answer')";
	mysql_query($sql);

	$sql = "insert into user_blogs values('$username', '$blog_name')";
	mysql_query($sql);

	$sql = "insert into blogs values('$blog_name', null, null, true, true, 0, 0)";
	mysql_query($sql);

	mysql_close($connection);
	
	header("Location: ../index.html");
?>